package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.PanelContent;
import com.mall.shopping.dto.PanelContentItemDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @description:
 * @author 岳子昂
 * @date 2022-01-20 21:40
 * @version 1.0
 */
@Mapper(componentModel = "spring")
public interface PanelContent2ContentItemDtoConverter {
    @Mappings({
            @Mapping(source = "id", target = "id"),
            @Mapping(source = "panelId", target = "panelId"),
            @Mapping(source = "type", target = "type"),
            @Mapping(source = "productId", target = "productId"),
            @Mapping(source = "sortOrder", target = "sortOrder"),
            @Mapping(source = "fullUrl", target = "fullUrl"),
            @Mapping(source = "picUrl", target = "picUrl"),
            @Mapping(source = "picUrl2", target = "picUrl2"),
            @Mapping(source = "picUrl3", target = "picUrl3"),
            @Mapping(source = "created", target = "created"),
            @Mapping(source = "updated", target = "updated")
    })
    PanelContentItemDto content2itemDto(PanelContent panelContent);

    List<PanelContentItemDto> contents2itemDtos (List<PanelContent> contents);
}
